//package com.example.demo.config;
//
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import springfox.documentation.builders.ParameterBuilder;
//import springfox.documentation.builders.PathSelectors;
//import springfox.documentation.builders.RequestHandlerSelectors;
//import springfox.documentation.schema.ModelRef;
//import springfox.documentation.service.ApiInfo;
//import springfox.documentation.service.Contact;
//import springfox.documentation.service.Parameter;
//import springfox.documentation.spi.DocumentationType;
//import springfox.documentation.spring.web.plugins.Docket;
//import springfox.documentation.swagger2.annotations.EnableSwagger2;
//
//import java.util.ArrayList;
//import java.util.List;
//
//@Configuration
//@EnableSwagger2
//public class SwaggerConfig {
//
//    // 配置swagger的docket实例
//    @Bean
//    public Docket docket(){
//        return new Docket(DocumentationType.SWAGGER_2)
//                .apiInfo(apiInfo())
//                .groupName("token组")
//                .select()
////                .apis(RequestHandlerSelectors.basePackage("com.zoo.lion.modules"))
//                .apis(RequestHandlerSelectors.withClassAnnotation(Api.class))//只生成被Api这个注解注解过的类接口
//                .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))//只生成被ApiOperation这个注解注解过的api接口
//                .paths(PathSelectors.any())
//                .build()
//                .globalOperationParameters(setHeaderToken())
//                ;
//    }
//    // 配置swagger信息 apiInfo
//    private ApiInfo apiInfo(){
//        // 作者信息
//        Contact contact = new Contact("磊子", "", "");
//
//        return new ApiInfo(
//                "swagger-token",
//                "Api 老哇撒",
//                "1.0",
//                "urn:tos",
//                contact,
//                "Apache 2.0",
//                "http://www.apache.org/licenses/LICENSE-2.0",
//                new ArrayList());
//    }
//
//    private List<Parameter> setHeaderToken() {
//        ParameterBuilder tokenPar1 = new ParameterBuilder();
//        ParameterBuilder tokenPar2 = new ParameterBuilder();
//        ParameterBuilder tokenPar3 = new ParameterBuilder();
//        List<Parameter> pars = new ArrayList<>();
//        tokenPar1.name("Authorization").description("Authorization")
//                .modelRef(new ModelRef("string"))
//                .parameterType("header").required(false).build();
//        tokenPar2.name("X-EOS-SourceSysKey").description("X-EOS-SourceSysKey")
//                .modelRef(new ModelRef("string"))
//                .parameterType("header").defaultValue("0debb444e00a4522b03022b3b5fd909a").required(false).build();
//        tokenPar3.name("Content-Type").description("Content-Type")
//                .modelRef(new ModelRef("string"))
//                .parameterType("header").defaultValue("application/json").required(false).build();
//        pars.add(tokenPar1.build());
//        pars.add(tokenPar2.build());
//        pars.add(tokenPar3.build());
//        return pars;
//    }
//}
